package gui2.g4;

import java.util.ArrayList;
import java.util.List;

public class ChatModel {

	private List<ChatMessage> messages = 
		new ArrayList<ChatMessage>();
	
	private List<ChatModelListener> listeners = 
		new ArrayList<ChatModelListener>();
	
	public void addListener(ChatModelListener l){
		listeners.add(l);
	}
	
	public void addMessage(ChatMessage m){
		messages.add(m);
		for(ChatModelListener l : listeners){
			l.messageAdded(messages);
		}
	}
}
